Skip to content

feat: add support_email to /info response#175

Merged
0xNgoo merged 7 commits into0xNgoo:mainfrom
Johnsmichael150:main
Apr 1, 2026
Merged

feat: add support_email to /info response#175
0xNgoo merged 7 commits into0xNgoo:mainfrom
Johnsmichael150:main

Conversation

@Johnsmichael150
Copy link
Copy Markdown
Contributor

Summary

The /info route already exposes the anchor name and asset list, but it does not expose a configured support email. A small support contact field makes the route more useful to integrators and testers without changing any core runtime behavior.

What changed

src/runtime/http/express-router.ts

  • Updated the /info handler to build the response as a mutable Record<string, unknown> and conditionally append support_email only when fullConfig.operational?.supportEmail is a non-empty string. Empty string is treated as not configured.

No changes to src/core/config.ts or src/types/config.tsoperational.supportEmail was already typed as string | undefined.

Acceptance criteria

  • Configured support email values appear in /info
  • The field is omitted when the config does not provide a support email

Tests

tests/mvp-express.integration.test.ts — 3 new focused integration tests:

  • Anchor with operational.supportEmail: 'support@example.com'GET /info body contains support_email equal to the configured value
  • Anchor without operational.supportEmailGET /info body does not contain support_email
  • Anchor with operational.supportEmail: ''GET /info body does not contain support_email

tests/info-support-email.property.test.ts — 2 property-based tests (100 runs each, using fast-check):

  • Round-trip: for any non-empty string, GET /info returns support_email equal to that exact string with status 200
  • Omission: for undefined or "", GET /info does not include support_email in the response body

Close #84

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds a support_email field to the /info endpoint and includes integration tests for its configuration. It also introduces a local expectTypeOf shim in test files. The review feedback recommends extracting the duplicated shim into a shared utility and refactoring repetitive test setup and teardown logic to improve maintainability.

Comment on lines +196 to +231
it('2b) /info includes support_email when configured', async () => {
const customDbUrl = makeSqliteDbUrlForTests();
const customAnchor = createAnchor({
network: { network: 'testnet' },
server: {},
security: {
sep10SigningKey: sep10ServerKeypair.secret(),
interactiveJwtSecret: 'jwt-test-secret-email',
distributionAccountSecret: 'distribution-test-secret',
},
assets: {
assets: [
{
code: 'USDC',
issuer: 'GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5',
},
],
},
operational: { supportEmail: 'support@example.com' },
framework: {
database: { provider: 'sqlite', url: customDbUrl },
},
});

await customAnchor.init();
const customInvoke = createMountedInvoker(customAnchor);
const response = await customInvoke({ path: '/info' });
expect(response.status).toBe(200);
expect(response.body.support_email).toBe('support@example.com');

await customAnchor.shutdown();
const customDbPath = customDbUrl.startsWith('file:')
? customDbUrl.slice('file:'.length)
: customDbUrl;
try { unlinkSync(customDbPath); } catch { /* ignore */ }
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The setup and teardown logic for customAnchor instances (creation, initialization, invocation, shutdown, and database cleanup) is repeated in this test and in test 2d. This boilerplate can make tests harder to read and maintain. Consider extracting this repetitive logic into a helper function or utilizing beforeEach/afterEach blocks for better test organization.

Comment on lines +8 to +18
/**
* Runtime no-op that preserves compile-time type assertions.
* Bun's test runner does not support vitest's `expectTypeOf` at runtime,
* so we use this shim instead. TypeScript still validates the type
* relationships at compile time via the generic constraints.
*/
function expectTypeOf<T>(_value: T) {
return {
toEqualTypeOf<U>(_?: U): void {},
toMatchTypeOf<U>(_?: U): void {},
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The expectTypeOf shim is duplicated across tests/kyc.test.ts and tests/types.test.ts. This can lead to maintenance issues if the shim needs to be updated in the future. Consider extracting this helper into a shared test utility file and importing it where needed to reduce duplication.

@0xNgoo
Copy link
Copy Markdown
Owner

0xNgoo commented Mar 28, 2026

@johnsmccain

Please fix ci

@0xNgoo 0xNgoo merged commit 9e9fdfa into 0xNgoo:main Apr 1, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support_email to /info response when configured

3 participants